using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Protocol;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneGeneralSet : NetSceneBaseEx<GeneralSetRequest, GeneralSetResponse, GeneralSetRequest.Builder>
	{
		private const string TAG = "NetSceneGeneralSet";
		public bool doScene(GENERAL_SET_TYPE type, string value)
		{
			Log.smethod_4("NetSceneGeneralSet", "doscene in");
			base.beginBuilder();
			this.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0);
			this.mBuilder.SetType = (int)type;
			this.mBuilder.SetValue = value;
			this.mSessionPack.mCmdID = 70;
			base.endBuilder();
			return true;
		}
		protected override void onFailed(GeneralSetRequest request, GeneralSetResponse response)
		{
			Log.smethod_4("NetSceneGeneralSet", "onFailed in");
			EventCenter.postEvent(EventConst.ON_NETSCENE_GENERAL_SET_TYPE_ERR, new NetSceneGeneralSetResult
			{
				type = (GENERAL_SET_TYPE)request.SetType,
				retCode = RetConst.MM_ERR_CLIENT
			}, null);
		}
		protected override void onSuccess(GeneralSetRequest request, GeneralSetResponse response)
		{
			Log.smethod_4("NetSceneGeneralSet", "onSuccess in");
			NetSceneGeneralSetResult netSceneGeneralSetResult = new NetSceneGeneralSetResult();
			netSceneGeneralSetResult.type = (GENERAL_SET_TYPE)request.SetType;
			netSceneGeneralSetResult.retCode = (RetConst)response.BaseResponse.Ret;
			if (netSceneGeneralSetResult.retCode != RetConst.MM_OK)
			{
				EventCenter.postEvent(EventConst.ON_NETSCENE_GENERAL_SET_TYPE_ERR, netSceneGeneralSetResult, null);
				return;
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_GENERAL_SET_TYPE_SUCCESS, netSceneGeneralSetResult, null);
		}
	}
}
